using System;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class Admin_Test :System.Web.UI.Page {
	protected override void OnInit(EventArgs e) {
		//System.Threading.Thread.CurrentPrincipal;
		//System.Security.Principal.WindowsIdentity wi = new System.Security.Principal.WindowsIdentity("Boris1");
		//wi.Impersonate();
		base.OnInit(e);
		//if (!HttpContext.Current.User.Identity.Name.ToLower().Contains("dimon") &&
		//    !HttpContext.Current.User.Identity.Name.ToLower().Contains("help")
		//  ) Response.End();
	}
	protected void Page_Load(object sender,EventArgs e) {
		//throw new SmartException("Here",new Exception());
	}

	protected void DoSQL(object sender, EventArgs e) {
		System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();
		sw.Start();
		using(SqlConnection conn = new SqlConnection(new Dimok.Aspx.Manager.UOX().db)) {
			conn.Open();
			SqlCommand cmd = new SqlCommand(((TextBox)sender).Text,conn);
			cmd.CommandTimeout = 60*3;
			SqlDataReader reader = cmd.ExecuteReader();
			if (!chkNoOutput.Checked)
				do {
					GridView gv = new GridView();
					gv.DataSource = reader;
					this.Form.Controls.Add(gv);
					gv.DataBind();
				} while (reader.NextResult());
		}
		spnTime.InnerHtml = sw.ElapsedMilliseconds.ToString("n0")+" @ " +DateTime.Now.ToString("hh:mm:ss");
	}
}
